<?php
/**
 * Created by PhpStorm.
 * User: tengwei
 * Date: 2018/11/22
 * Time: 9:56 AM
 */
namespace common\sources\write\systemconfig;

use common\models\craftsman\SystemConfig;

class SystemConfigAccess implements ISystemConfigAccess
{
    public function CheckRefundType($data) {
        $config = SystemConfig::findOne(['ConfigName' => $data['ConfigName']]);
        if (!$config) {
            $config = new SystemConfig();
            $config->ConfigName = $data['ConfigName'];
        }
        $config->ConfigDesc = isset($data['ConfigDesc']) ? $data['ConfigDesc'] : '';
        $config->ConfigValue = $data['ConfigValue'];
        if ($config->save()) {
            return true;
        }
        return false;
    }
}